using System.Collections.Generic;
using System.Xml.Serialization;
using Microsoft.Office.Server.Search.Administration;
using SharepointSearch = Microsoft.Office.Server.Search.Administration;

namespace Winsmarts.SSPC.CrawlProperties.BO
{
    [XmlRoot("Category")]
    public class CategoryInfo
    {
        public CategoryInfo() { }

        private string name;
        private List<CrawledPropertyInfo> crawledProperties = new List<CrawledPropertyInfo>();

        [XmlAttribute]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public List<CrawledPropertyInfo> CrawledProperties
        {
            get { return crawledProperties; }
            set { crawledProperties = value; }
        }

        public CategoryInfo(Category category)
        {
            name = category.Name;

            foreach (CrawledProperty crawlProperty in category.GetAllCrawledProperties())
            {
                crawledProperties.Add(new CrawledPropertyInfo(crawlProperty));
            }
        }
    }
}
